#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
double myPow(double x, int n)
{
    double result = 1;
    int symbol = 1;
    if (n == 0 || x == 1)
    {
        return 1;
    }
    else if (n < 0)
    {
        symbol = 0;
        result = x;
        n++;
        n = -n;
    }
    while (n > 0)
    {
        if (n % 2 == 0)
        {
            x *= x;
            n /= 2;
        }
        result *= x;
        n--;
    }
    if (symbol == 0)
        result = 1 / result;
    return result;
}
int main()
{
    printf("%lf", myPow(2, 5));
    return 0;
}